package com.example.a421;

public  abstract class Duck {
    FlyBehavior flyBehavior;
    QuackBehavior quackBehavior;

    public  void performQuack(){
        //System.out.printin("呱呱叫")；
        quackBehavior.quack();
    }
    public void performFly(){
        flyBehavior.fly();
    }

    public  abstract void display();

    public void swim(){
        System.out.println("I can swim");
    }

    public void setFlyBehavior(FlyBehavior flyBehavior){
        this.flyBehavior=flyBehavior;
    }

    public void setQuackBehavior(QuackBehavior quackBehavior){
        this.quackBehavior=quackBehavior;
    }

}
